<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
</head>
<body>

<div id="application">
    <button @click="decrease"> - </button>
    <span v-text="number"></span>
    <button @click="increase"> + </button>
</div>

<script type="text/javascript">
    let vueModel = new Vue({
        el : "#application",
        data : {
            number : 5
        },
        methods : {
            increase : function () {
                if (this.number === 10) {
                    alert("不可相加了...");
                    return;
                }
                this.number += 1;
            },
            decrease : function () {
                if (this.number === 0) {
                    alert("不可减少了...");
                    return;
                }
                this.number -= 1;
            }
        }
    });
</script>
</body>
</html>